cmake_minimum_required(VERSION 3.10)
project(onvif_library)

# set(CMAKE_C_FLAGS  -DWITH_OPENSSL -DWITH_NONAMESPACES -DWITH_DOM)
add_compile_options(-DWITH_OPENSSL)
add_compile_options(-DWITH_NONAMESPACES)
add_compile_options(-DWITH_DOM)


AUX_SOURCE_DIRECTORY(. DIR_SRCS)

# 链接源码编译的SSL
# set(INC_DIR /home/shun/work/library/openssl-OpenSSL_1_0_2r/install/include)
# set(LINK_DIR /home/shun/work/library/openssl-OpenSSL_1_0_2r/install/lib)
# include_directories(${INC_DIR})
# set(opensslLib /home/shun/work/library/openssl-OpenSSL_1_0_2r/install/lib/libssl.a 
# /home/shun/work/library/openssl-OpenSSL_1_0_2r/install/lib/libcrypto.a)


# link_directories(${LINK_DIR})
# link_libraries(openssl libcrypto)
# option(WITH_OPENSSL "Enable OpenSSL support" ON)

#链接系统的SSL
# find_package(OpenSSL REQUIRED)

# if (NOT OpenSSL_FOUND)
#     message(FATAL_ERROR "OpenSSL Not Found!")
# else ()
#     message(STATUS "OpenSSL_LIBS: ${OPENSSL_LIBRARIES}")
#     message(STATUS "OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
# endif (NOT OpenSSL_FOUND)
# include_directories(${OPENSSL_INCLUDE_DIR})


add_library(onvifLib SHARED ${DIR_SRCS})
# target_link_libraries(onvif swresample ssl crypto)
target_link_libraries(onvifLib ssl crypto)
# target_link_libraries(onvifLib ${OPENSSL_LIBRARIES})
# target_link_libraries(onvifLib ${opensslLib})

